import React,{Component} from 'react';
import {BrowserRouter,Route,Switch} from 'react-router-dom';
import MainPage from '../page/main/index';
import list from '../page/list';
import about from '../page/about';
import NoMatch from "../page/404";
import Login from '../page/login';
//BrowserRouter 是一个容器（对象）   用来存放route link
//Router 是一个容器  ，包裹Route
//Route 显示视图 三大 props
//location  路由的位置信息  location.hash     location.pathname
//history  history.go()   history.push()
//match 匹配路径参数

//Link  链接  跳转
//Redirect  重定向

class Routes extends Component{
  render(){
    return(
      <div>
        <BrowserRouter>
          <Switch>
            <Route path="/main" render={()=>
            <MainPage>
                  <Route exact path="/main/about" component={about}/>
                  <Route exact path="/main" component={list}/>
            </MainPage>
            }/>  
            <Route exact path="/login" component={Login}></Route>
            <Route component={NoMatch}></Route>
          </Switch>
        </BrowserRouter>
      </div>

    )
  }
}
export default Routes;
